﻿<script src="~/vue/dist/vue.global.js"></script>
<link href="~/element-plus/dist/index.css" rel="stylesheet" />
<script src="~/element-plus/dist/index.full.js"></script>
<script src="~/axios/dist/axios.js"></script>
<script src="~/lib/microsoft/signalr/dist/browser/signalr.js"></script>
<div id="app">
<div style="background-color:#ffd553;width:100%;height:70px">
    <table style="width: 70%; margin-left: 30%;">
        <tr>
            <td style="text-align: right;width:30%">
                <p style="font-size: 40px; margin: 0; color: white; filter:progid:DXImageTransform.Microsoft.Shadow(color=black,direction=120,strength=5); text-shadow: 4px 4px 15px black;">
                    人力资源管理系统
                </p>
            </td>
            <td style="text-align: right;font-size:17px;width:35%;color:black;">
                <br />
                欢迎你：@ViewBag.UserTrueName (@ViewBag.RolesName)&nbsp;
                <el-button v-on:click="close()" class="BUTTON_STYLE1">退出系统</el-button>
            </td>
        </tr>
    </table>
</div>
    <el-container>
        <el-container>
            <el-aside width="100%">
                <el-tree :data="data1" :props="defaultProps" v-on:node-click="handleNodeClick"></el-tree>
            </el-aside>
            <el-main style="padding:0px;">
                <iframe :src="src" frameborder="0" width="100%" height="100%" scrolling="no"></iframe>
            </el-main>
        </el-container>
    </el-container>
</div>
<style>
    .el-tree__empty-block {
        height: 100%;
        min-height: 20px;
        position: relative;
        text-align: center;
        width: 100%;
    }
    .el-aside {
        height: 1700px;
        overflow-y: auto;
        width: 200px;
        background-color: #ffffbb;
    }

    .el-tree-node__content {
        background-color: #ffffbb;
    }

    .el-container .el-main {
        background-color: #ffffbb;
        --el-main-padding: 20px;
        box-sizing: border-box;
        display: block;
        flex: 1;
        flex-basis: auto;
        overflow: hidden;
        padding: var(--el-main-padding);
    }

</style>
<script>
    window.userTrueName = '@ViewBag.UserTrueName'; // 将ViewBag的值赋给全局变量，方便Vue实例获取
    window.rolesName = '@ViewBag.RolesName'; // 将ViewBag的值赋给全局变量，方便Vue实例获取
    const { createApp, ref, reactive, computed } = Vue
    const { ElNotification } = ElementPlus;
    var app = createApp({
        setup() {
            const src = ref("/Login/Hello");
            const data1 = ref([])
            const data = ref([
                    {
                    label: "招聘管理",
                    children: [
                        {
                            label: "职位发布管理",
                            children: [
                                { label: "职位发布登记", url: "/EMR/Index" },
                                { label: "职位发布变更", url: "/EMR/IndexShow" },
                                { label: "职位发布查询", url: "/EMR/Indexshengqing" }
                            ]
                        },
                                {
                                    label: "简历管理",
                                    children: [
                                { label: "简历登记", url: "/EMR/Indexshengqing" },
                                { label: "简历筛选", url: "/ER/IndexJLCX" },
                                { label: "有效简历查询", url: "/ER/IndexYXJLCX" }
                                    ]
                                },
                                {
                                    label: "面试管理",
                                    children: [
                                        { label: "面试结果登记", url: "/ER/IndexMSJGDJ" },
                                { label: "面试筛选", url: "/ER/IndexMSSX" }
                                    ]
                                },
                        {
                            label: "录用管理",
                            children: [
                                { label: "录用申请", url: "/ER/IndexLYSQ" },
                                { label: "录用审批", url: "/ER/IndexLYSQ1" },
                                { label: "录用查询", url: "/ER/ " }
                            ]
                        }
                    ]
                },
                {
                    label: "人力资源档案管理",
                    children: [
                        { label: "人力资源档案登记", url :"/HF/Index"},
                        { label: "人力资源档案登记复核", url :"/HF/HFReview"},
                        { label: "人力资源档案查询", url: "/HF/HFSelect" },
                        { label: "人力资源档案变更", url: "/HF/HFChange" },
                        {
                            label: "人力资源档案删除管理",
                            children: [
                                { label: "人力资源档案删除", url: "/HF/HFDelete" },
                                { label: "档案删除恢复", url: "/HF/HFRestore" },
                                { label: "人力资源档案永久删除", url: "/HF/HFPermanentlyDelete" }
                            ]
                        }
                    ]
                },
                {
                    label: "薪酬标准管理",
                    children: [
                        { label: "薪酬标准登记", url: "/SS/Index" },
                        { label: "薪酬标准登记复核", url: "/SS/Index2" },
                        { label: "薪酬标准查询", url: "/SS/SSSelect" },
                        { label: "薪酬标准变更", url: "/SS/SSchangePage" }
                    ]
                },
                {
                    label: "薪酬发放管理",
                    children: [
                        { label: "薪酬发放登记", url: "/SG/Index" },
                        { label: "薪酬发放登记复核", url: "/SG/SGChangePage" },
                        { label: "薪酬发放查询", url: "/SG/SGSelectWherePage" }
                    ]
                },
                {
                    label: "调动管理",
                    children: [
                        { label: "调动登记", url: "/MC/Index" },
                        { label: "调动审核", url: "/MC/Index2" },
                        { label: "调动查询", url: "/MC/Index3" }
                    ]
                },
                {
                    label: "客户化设置",
                    children: [
                        {
                            label: "人力资源档案管理设置",
                            children: [
                                { label: "Ⅰ级机构设置", url: "/CFFK/Index" },
                                { label: "Ⅱ级机构设置", url: "/CFSK/Index" },
                                { label: "Ⅲ级机构设置", url: "/CFTK/Index" },
                                { label: "职称设置", url: "/CPC/Index1" },
                                { label: "职位分类设置", url: "/CMK/Index" },
                                { label: "职位设置", url: "/CM/Index1" },
                                { label: "公共属性设置", url: "/CPC/Index" }
                            ]
                        },
                        {
                            label: "薪酬管理设置",
                            children: [
                                { label: "薪酬项目设置", url: "/CPC/Index2" },
                                { label: "薪酬发放方式设置", url: "" }
                            ]
                        },
                        { label: "其他设置", url: "" },
                        { label: "关键字查询设置", url: "" }
                    ]
                },
                {
                    label: "标准数据报表",
                    children: [
                        { label: "Excel标准数据报表", url: "" },
                        { label: "Pdf标准数据报表", url: "" },
                        { label: "Xml标准数据报表", url: "" }
                    ]
                },
                {
                    label: "权限管理",
                    children: [
                        { label: "用户管理", url: "/Roles/Index1" },
                        { label: "角色管理", url: "/Roles/Index" }
                    ]
                }
            ]);
            function handleNodeClick(nodeData) {
                // 设置src变量
                src.value = nodeData.url;
            }

            function decodeHtml(html) {
                var txt = document.createElement("textarea");
                txt.innerHTML = html;
                return txt.value;
            }

            //欢迎登录
            function open2(){
                var decodedRolesName = decodeHtml(window.rolesName);
                var decodedUserTrueName = decodeHtml(window.userTrueName);
                ElNotification({
                  title: '消息提示',
                  message: `欢迎你：${decodedRolesName}${decodedUserTrueName}！`,
                  position: 'bottom-right',
                })
                if (decodedRolesName == "审核员"){
                    inited();
                }
            }
            open2()

            function QX(){
                axios.get("/Login/QX").then(res=>{
                    data1.value = res.data
                    console.info(res.data)
                }).catch(error=>{
                    console.info(error)
                })
            }
            QX();

            function close(){
                //点击跳转到默认地址
                window.location.href ="/"
            }

            function inited(){
                var url = "http://localhost:5253";
                connection = new signalR.HubConnectionBuilder().withUrl(url + "/chatHub").build();

                //1 监听来自服务器端对ReceiveMessage的调用
                connection.on("ReceiveMessage",function(user,message){

                    ElNotification({
                        title: user,
                        message: message,
                        position: 'bottom-right'

                    });
                });

                //2 打开链接
                connection.start().then(function(){
                    console.info("开启链接");
                }).catch(function(err){
                    return console.error(err.toString());
                })
            }



            return {
                data,handleNodeClick,src,close,data1
            }
            }
        })
    app.use(ElementPlus)
    app.mount("#app");
</script>